package com.wang.pages.usermgm;

import java.util.Date;

import javax.inject.Inject;

import org.apache.tapestry5.annotations.Property;

import com.wang.entities.User;
import com.wang.services.StateDAO;

public class UserCreate {
	@Property
	private User user;
	@Inject
	private StateDAO dao;

	void onPrepare() {
		user = new User();
	}

	Object onSuccess() {
		if (user.getTime() == null) {
			user.setTime(new Date());
		}
		dao.create(user);
		return UserList.class;
		//return this;
	}
}
